<?=$this->Html->script('app/components/alert/alert.svc', ['block' => true]);?>
<?=$this->Html->script('Institution.angular/students/institutions.students.svc', ['block' => true]);?>
<?=$this->Html->script('Institution.angular/students/institutions.students.ctrl', ['block' => true]);?>
<?php
$this->extend('OpenEmis./Layout/Panel');
$this->start('panelBody');
$session = $this->request->session();
$institutionId = $session->read('Institution.Institutions.id');

$tooltipMessage = __('The password is automatically generated by the system');

$this->Html->css('ControllerAction.../plugins/datepicker/css/bootstrap-datepicker.min', ['block' => true]);
$this->Html->script('ControllerAction.../plugins/datepicker/js/bootstrap-datepicker.min', ['block' => true]);

?>
<div class="alert {{class}}" ng-hide="message == null">
    <a class="close" aria-hidden="true" href="#" data-dismiss="alert">×</a><?=__('{{message}}')?>
</div>
<div class="wizard" data-initialize="wizard" id="wizard">
    <div class="steps-container">
        <ul class="steps" style="margin-left: 0">
            <li data-step="1" class="active" data-name="internalSearch">
                <div class="step-wrapper">
                    <?=__('Internal Search')?>
                    <span class="chevron"></span>
                </div>
            </li>

            <li data-step="2" data-name="externalSearch" ng-show="InstitutionStudentController.hasExternalDataSource">
                <div class="step-wrapper">
                    <?=__('External Search')?>
                    <span class="chevron"></span>
                </div>
            </li>
            <li data-step="3" data-name="createUser" ng-show="InstitutionStudentController.createNewStudent">
                <div class="step-wrapper">
                    <?=__('New Student Details')?>
                    <span class="chevron"></span>
                </div>
            </li>
            <li data-step="4" data-name="addStudent">
                <div class="step-wrapper">
                    <?=__('Add Student')?>
                    <input type="hidden" ng-model="InstitutionStudentController.hasExternalDataSource" ng-init="InstitutionStudentController.hasExternalDataSource = <?php if ($externalDataSource) {
    echo 'true';
} else {
    echo 'false';
}
?>; InstitutionStudentController.institutionId=<?=$institutionId;?>;"/>
                    <span class="chevron"></span>
                </div>
            </li>
            <li data-step="5" data-name="transferStudent" ng-show="InstitutionStudentController.studentTransferable">
                <div class="step-wrapper">
                    <?=__('Transfer Student')?>
                    <span class="chevron"></span>
                </div>
            </li>
        </ul>
    </div>
    <div class="actions top">
        <?php if ($_createNewStudent): ?>
        <button
            ng-if="((!InstitutionStudentController.initialLoad && !InstitutionStudentController.hasExternalDataSource)
            || (!InstitutionStudentController.initialLoad && InstitutionStudentController.step == 'external_search')
            ) && (InstitutionStudentController.step == 'external_search' || InstitutionStudentController.step == 'internal_search')"
            ng-disabled="InstitutionStudentController.selectedStudent"
            ng-click="InstitutionStudentController.onAddNewStudentClick()"
            type="button" class="btn btn-default"><?=__('Create New Student')?>
        </button>
        <?php endif;?>
        <button
            type="button" class="btn btn-default" ng-click="InstitutionStudentController.onExternalSearchClick()"
            ng-if="(!InstitutionStudentController.initialLoad && InstitutionStudentController.hasExternalDataSource && InstitutionStudentController.showExternalSearchButton && InstitutionStudentController.step=='internal_search')" ng-disabled="InstitutionStudentController.selectedStudent"><?=__('External Search')?>
        </button>
        <button
            ng-if="InstitutionStudentController.rowsThisPage.length > 0 && (InstitutionStudentController.step=='internal_search' || InstitutionStudentController.step=='external_search')"
            ng-click="InstitutionStudentController.onAddStudentClick()"
            ng-disabled="!InstitutionStudentController.selectedStudent"
            type="button" class="btn btn-default"><?=__('Add Student')?>
        </button>
        <button
            type="button" class="btn btn-default"
            ng-if="(InstitutionStudentController.step=='add_student' && InstitutionStudentController.studentTransferable)"
            ng-click="InstitutionStudentController.onTransferStudentClick()">
            <?=__('Transfer Student')?>
        </button>
        <button
            type="button" class="btn btn-default"
            ng-if="(InstitutionStudentController.step=='add_student' && !InstitutionStudentController.studentTransferable)"
            ng-disabled="InstitutionStudentController.existingStudent"
            ng-click="InstitutionStudentController.onAddStudentCompleteClick()">
            <?=__('Complete')?>
        </button>
        <button
            type="button" class="btn btn-default btn-next"
            ng-show="(InstitutionStudentController.step=='create_user' || InstitutionStudentController.step=='transfer_student')"
            data-last="<?=__('Save')?>">
            <?=__('Next')?>
        </button>
    </div>
    <div class="step-content">
        <div class="step-pane sample-pane active" data-step="1" data-name="internalSearch">
            <div class="dropdown-filter">
                <div class="filter-label">
                    <i class="fa fa-filter"></i>
                    <label><?=__('Filter')?></label>
                </div>
                <div class="text">
                    <label><?=__('Student ID')?></label>
                    <input ng-model="InstitutionStudentController.internalFilterOpenemisNo" ng-keyup="$event.keyCode == 13 ? InstitutionStudentController.reloadInternalDatasource(true) : null" type="text" id="" maxlength="150">
                </div>
                <div class="text">
                    <label><?=__('Full Name')?></label>
                    <input ng-model="InstitutionStudentController.internalFilterFirstName" ng-keyup="$event.keyCode == 13 ? InstitutionStudentController.reloadInternalDatasource(true) : null" type="text" id="" maxlength="150">
                </div>
                <div class="text">
                    <label><?=__('Name with initials')?></label>
                    <input ng-model="InstitutionStudentController.internalFilterLastName" ng-keyup="$event.keyCode == 13 ? InstitutionStudentController.reloadInternalDatasource(true) : null" type="text" id="" maxlength="150">
                </div>
                <div class="text">
                    <label><?=__('Identity Number')?></label>
                    <input ng-model="InstitutionStudentController.internalFilterIdentityNumber" ng-keyup="$event.keyCode == 13 ? InstitutionStudentController.reloadInternalDatasource(true) : null" type="text" id="" maxlength="150">
                </div>
                <div class="date">
                    <label for="Students_date_of_birth"><?=__('Date Of Birth')?></label>
                    <div class="input-group date " id="Students_date_of_birth" style="">
                        <input type="text" class="form-control " name="Students[date_of_birth]" ng-model="InstitutionStudentController.internalFilterDateOfBirth" ng-keyup="$event.keyCode == 13 ? InstitutionStudentController.reloadInternalDatasource(true) : null">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                    </div>
                </div>

                <div class="search-action-btn margin-top-10 margin-bottom-10">
                    <button class="btn btn-default btn-xs" ng-click="InstitutionStudentController.reloadInternalDatasource(true)"><?=__('Filter')?></button>
                    <button class="btn btn-outline btn-xs" ng-click="InstitutionStudentController.clearInternalSearchFilters()" type="reset" value="Clear"><?=__('Clear')?></button>
                </div>
            </div>

            <div class="table-wrapper">
                <div>
                    <div class="scrolltabs">
                        <div id="institution-student-table" class="table-wrapper">
                            <div ng-if="InstitutionStudentController.internalGridOptions" kd-ag-grid="InstitutionStudentController.internalGridOptions" ag-selection-type="radio" class="ag-height-fixed"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="step-pane sample-pane active" data-step="2" data-name="externalSearch">
            <div class="dropdown-filter">
                <div class="filter-label">
                    <i class="fa fa-filter"></i>
                    <label><?=__('Filter')?></label>
                </div>
                <div class="text">
                    <label><?=__('Full Name')?></label>
                    <input ng-model="InstitutionStudentController.internalFilterFirstName" ng-disabled="true" type="text" id="" maxlength="150">
                </div>
                <div class="text">
                    <label><?=__('Name with initials')?></label>
                    <input ng-model="InstitutionStudentController.internalFilterLastName" ng-disabled="true" type="text" id="" maxlength="150">
                </div>
                <div class="text">
                    <label><?=__('Identity Number')?></label>
                    <input ng-model="InstitutionStudentController.internalFilterIdentityNumber" ng-disabled="true" type="text" id="" maxlength="150">
                </div>
                <div class="text">
                    <label for="Students_date_of_birth"><?=__('Date Of Birth')?></label>
                        <input type="text" class="form-control " name="Students[date_of_birth]" ng-model="InstitutionStudentController.internalFilterDateOfBirth" ng-disabled="true">
                </div>
            </div>

            <div class="table-wrapper">
                <div>
                    <div class="scrolltabs sticky-content">
                        <div id="institution-student-table" class="table-wrapper">
                            <div ng-if="InstitutionStudentController.externalGridOptions" kd-ag-grid="InstitutionStudentController.externalGridOptions" ag-selection-type="radio" class="ag-height-fixed"></div>
                        </div>
                    </div>
                </div>
            </div>
        </div>

        <div class="step-pane sample-pane" data-step="3" data-name="createUser">
            <form class="form-horizontal ng-pristine ng-valid" accept-charset="utf-8" method="post">
                <div class="input string required">
                    <label><?=__('Student ID')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.openemis_no" type="string" ng-disabled="true">
                    <div ng-if="InstitutionStudentController.postResponse.error.openemis_no" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.openemis_no">{{ error }}</p>
                    </div>
                </div>
                <div class="input string required">
                    <label><?=__('Full Name')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.first_name" ng-change="InstitutionStudentController.setStudentName()" type="string" ng-init="InstitutionStudentController.selectedStudentData.first_name='';">
                    <div ng-if="InstitutionStudentController.postResponse.error.first_name" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.first_name">{{ error }}</p>
                    </div>
                </div>

                <div class="input string required">
                    <label><?=__('Name with initials')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.last_name" ng-change="InstitutionStudentController.setStudentName()" type="string" ng-init="InstitutionStudentController.selectedStudentData.last_name='';">
                    <div ng-if="InstitutionStudentController.postResponse.error.last_name" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.last_name">{{ error }}</p>
                    </div>
                </div>
                <div class="input string required">
                    <label><?=__('Preferred Name')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.preferred_name" ng-change="InstitutionStudentController.setStudentName()" type="string" ng-init="InstitutionStudentController.selectedStudentData.preferred_name='';">
                    <div ng-if="InstitutionStudentController.postResponse.error.preferred_name" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.preferred_name">{{ error }}</p>
                    </div>
                </div>
                <div class="input select required error">
                    <label><?=__('Sex')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[gender_id]" id="students-gender_id"
                            ng-options="option.id as option.name for option in InstitutionStudentController.genderOptions"
                            ng-model="InstitutionStudentController.selectedStudentData.gender_id"
                            ng-change="InstitutionStudentController.changeGender()"
                            ng-init="InstitutionStudentController.selectedStudentData.gender_id='';"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.gender_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.gender_id">{{ error }}</p>
                    </div>
                </div>

                <!-- <div class="input select required error">
                    <label><?=__('Birth Registrar Office ')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[area_administrative_id]" class="areapicker" id="area_administrative_division"
                            ng-options="option.id as option.name for option in InstitutionStudentController.divisionOption"
                            ng-model="InstitutionStudentController.selectedStudentData.area_administrative_id"
                            ng-change="InstitutionStudentController.changeSecre ()"
                            ng-init="InstitutionStudentController.selectedStudentData.area_administrative_id='';"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.area_administrative_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.area_administrative_id">{{ error }}</p>
                    </div>
                </div> -->

                <div class="input date required">
                    <label for="Student_date_of_birth"><?=__('Date Of Birth')?></label>
                    <div class="input-group date " id="Student_date_of_birth" style="">
                        <input type="text" class="form-control " name="Student[date_of_birth]" ng-model="InstitutionStudentController.selectedStudentData.date_of_birth" ng-init="InstitutionStudentController.selectedStudentData.date_of_birth='';">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.date_of_birth" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.date_of_birth">{{ error }}</p>
                    </div>
		</div>
                <div class="input select required error">
                    <label><?=__('Posses a Valid Birth Certificate')?></label>
		    <div class="input-select-wrapper">
			<select name="Students[having_bc]" id="having_bc"
				ng-options="option.id as option.name for option in  InstitutionStudentController.BCOptions.availableOptions track by option.id"
				ng-model="InstitutionStudentController.selectedStudentData.having_bc"
				ng-change="InstitutionStudentController.changeBC()"
				ng-init="InstitutionStudentController.selectedStudentData.having_bc='';"
			    >
				<option value=""   > --<?=__('Select')?>-- </option>
			</select>
		    </div>
                     <div ng-show="InstitutionStudentController.selectedStudentData.having_bc == 1 " class="error-message">
                                <p>Warning: Please double check before put ‘’No’’. You must enter
‘’yes’’, if a student has a valid birth certificate</p>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.having_bc" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.having_bc">{{ error }}</p>
                    </div>
		</div>
               <div ng-hide="InstitutionStudentController.selectedStudentData.having_bc == 1">
		<div class="input select required error">
                    <label><?=__('Birth District')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[area_administrative_province]" class="areapicker" id="area_administrative_province"
                            ng-options="option.id as option.name for option in InstitutionStudentController.provinceOption"
                            ng-model="InstitutionStudentController.selectedStudentData.area_administrative_province"
                            ng-change="InstitutionStudentController.changeProvince()"
                            ng-init="InstitutionStudentController.selectedStudentData.area_administrative_province='';"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.area_administrative_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.area_administrative_province">{{ error }}</p>
                    </div>
                </div>
                <div class="input select error">
                    <label><?=__('Birth Divisional Secretariat')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[area_administrative_district]" class="areapicker" id="area_administrative_district"
                            ng-options="option.id as option.name for option in InstitutionStudentController.districtOption"
                            ng-model="InstitutionStudentController.selectedStudentData.area_administrative_district"
                            ng-change="InstitutionStudentController.changeDistrict()"
                            ng-init="InstitutionStudentController.selectedStudentData.area_administrative_district='';"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.area_administrative_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.area_administrative_district">{{ error }}</p>
                    </div>
                </div>
                <div class="input select required error">
                    <label><?=__('Birth Registrar Division')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[area_administrative_id]" class="areapicker" id="area_administrative_id"
                            ng-options="option.id as option.name for option in InstitutionStudentController.divisionOption"
                            ng-model="InstitutionStudentController.selectedStudentData.area_administrative_id"
                            ng-change="InstitutionStudentController.changeDivision()"
                            ng-init="InstitutionStudentController.selectedStudentData.area_administrative_id='';"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.area_administrative_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.area_administrative_id">{{ error }}</p>
                    </div>
                </div>
                <div ng-class="InstitutionStudentController.Student.nationality_class" ng-show="InstitutionStudentController.StudentNationalities != 2">
                    <label><?=__('Nationality')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[nationality_id]" id="students-nationality_id"
                            ng-options="option.id as option.name for option in InstitutionStudentController.StudentNationalitiesOptions"
                            ng-model="InstitutionStudentController.Student.nationality_id"
                            ng-change="InstitutionStudentController.changeNationality()"
                            ng-init="InstitutionStudentController.Student.nationality_id='';"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.nationalities[0].nationality_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.nationalities[0].nationality_id">{{ error }}</p>
                    </div>
                </div>
                <div ng-class="InstitutionStudentController.Student.identity_type_class" ng-show="InstitutionStudentController.StudentIdentities != 2 && InstitutionStudentController.StudentNationalities == 2">
                    <label><?=__('Identity Type')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[identities_type_id]" id="students-identities_type_id"
                            ng-options="option.id as option.name for option in InstitutionStudentController.StudentIdentitiesOptions"
                            ng-model="InstitutionStudentController.Student.identity_type_id"
                            ng-change="InstitutionStudentController.changeIdentityType()"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.identities[0].identity_type_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.identities[0].identity_type_id">{{ error }}</p>
                    </div>
                </div>
                <div ng-class="InstitutionStudentController.Student.identity_class" ng-show="InstitutionStudentController.StudentIdentities != 2">
                    <label><?=__('{{InstitutionStudentController.Student.identity_type_name}}')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.identity_number" type="string" ng-init="InstitutionStudentController.selectedStudentData.identity_number='';">

                    <div ng-if="InstitutionStudentController.postResponse.error.identities[0].number" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.identities[0].number">{{ error }}</p>
                    </div>
		</div>
               </div>
                <div class="input string required">
                    <input ng-model="InstitutionStudentController.selectedStudentData.username" type="hidden" ng-init="InstitutionStudentController.selectedStudentData.username='';">
                    <div ng-if="InstitutionStudentController.postResponse.error.username" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.username">{{ error }}</p>
                    </div>
                </div>

                <div class="input password required">
                    <input ng-model="InstitutionStudentController.selectedStudentData.password" type="hidden" ng-init="InstitutionStudentController.selectedStudentData.password='';">
                    <div ng-if="InstitutionStudentController.postResponse.error.password" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.password">{{ error }}</p>
                    </div>
                </div>
            </form>
        </div>

        <div class="step-pane sample-pane" data-step="4" data-name="addStudent">
            <form class="form-horizontal ng-pristine ng-valid" accept-charset="utf-8" method="post" >
                <div class="input string required">
                    <label><?=__('Student ID')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.openemis_no" type="string" ng-disabled="true">
                    <div ng-if="InstitutionStudentController.postResponse.error.openemis_no" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.openemis_no">{{ error }}</p>
                    </div>
                </div>
                <div class="input string required">
                    <label><?=__('Admission Number')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['admission_id']" type="number" id="" maxlength="12" >
                    <div ng-if="InstitutionStudentController.postResponse.error.admission_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.admission_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string" ng-model="InstitutionStudentController.postResponse">
                    <label><?=__('Student')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.name" type="string" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.first_name" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.first_name">{{ error }}</p>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.last_name" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.last_name">{{ error }}</p>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.student_name" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.student_name">{{ error }}</p>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.student_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.student_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string" ng-show="InstitutionStudentController.StudentNationalities != 2 && StudentController.createNewStudent == true">
                    <label><?=__('Nationality')?></label>
                    <input ng-model="InstitutionStudentController.Student.nationality_name" type="string" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.nationalities[0].nationality_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.nationalities[0].nationality_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string" ng-show="InstitutionStudentController.StudentIdentities != 2" ng-hide="InstitutionStudentController.selectedStudentData.having_bc == 1" >
                    <label><?=__('Identity Number')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.identity_number" type="string" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.identities[0].number" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.identities[0].number">{{ error }}</p>
                    </div>
                </div>
                <div class="input string">
                    <label><?=__('Date Of Birth')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.date_of_birth" type="string" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.date_of_birth" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.date_of_birth">{{ error }}</p>
                    </div>
                </div>
                <div class="input string">
                    <label><?=__('Gender')?></label>
                    <input ng-model="InstitutionStudentController.selectedStudentData.gender.name" type="string" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.gender_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.gender_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string required">
                    <input ng-model="InstitutionStudentController.selectedStudentData.username" type="hidden" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.username" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.username">{{ error }}</p>
                    </div>
                </div>

                <div class="input password required" ng-show="!InstitutionStudentController.existingStudent">
                    <input ng-model="InstitutionStudentController.selectedStudentData.password" type="hidden" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.password" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.password">{{ error }}</p>
                    </div>
                </div>
                <!-- <div class="input select " ng-model="InstitutionStudentController.postResponse" ng-show="!InstitutionStudentController.existingStudent">
                    <label>('Has Attended  Pre School')</label>
                    <div class="input-select-wrapper">
                        <select name="Students[is_attended_pre_school]"
                         ng-model="InstitutionStudentController.isAttendedPreSchoolOptions.selectedOption"
                         ng-options="option.name for option in InstitutionStudentController.isAttendedPreSchoolOptions.availableOptions track by option.id"
                         ng-init="InstitutionStudentController.isAttendedPreSchoolOptions.selectedOption.id=''"
                         id="students-is-attended-pre-school"
                        >
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.academic_period_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.academic_period_id">{{ error }}</p>
                    </div>
                </div> -->
                <div class="input select required" ng-model="InstitutionStudentController.postResponse" ng-show="!InstitutionStudentController.existingStudent">
                    <label><?=__('Academic Period')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[academic_period_id]" id="students-academic-period-id"
                            ng-options="option.name for option in InstitutionStudentController.academicPeriodOptions.availableOptions track by option.id"
                            ng-model="InstitutionStudentController.academicPeriodOptions.selectedOption"
                            ng-change="InstitutionStudentController.onChangeAcademicPeriod()"
                            >
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.academic_period_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.academic_period_id">{{ error }}</p>
                    </div>
                </div>

                <div class="input select required error" ng-model="InstitutionStudentController.postResponse" ng-show="!InstitutionStudentController.existingStudent">
                    <label><?=__('Education Grade')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[education_grade_id]" id="students-education-grade-id"
                            ng-options="option.education_grade.name for option in InstitutionStudentController.educationGradeOptions.availableOptions track by option.id"
                            ng-model="InstitutionStudentController.educationGradeOptions.selectedOption"
                            ng-change="InstitutionStudentController.onChangeEducationGrade()"
                            >
                            <option value="" >-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.education_grade_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.education_grade_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input select" ng-show="!InstitutionStudentController.existingStudent">
                    <label><?=__('Class')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[class]" id="students-class"
                            ng-options="option.name for option in InstitutionStudentController.classOptions.availableOptions track by option.id"
                            ng-model="InstitutionStudentController.classOptions.selectedOption"
                            ng-change="InstitutionStudentController.onChangeClass()"
                            >
                            <option value="" >-- <?=__('No Class Assignment')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.institution_class_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.institution_class_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string" ng-show="!InstitutionStudentController.existingStudent">
                    <label><?=__('Student Status')?></label>
                    <input type="string" value="<?=__('Pending Admission')?>" disabled="disabled">
                </div>
                <div class="input date required" ng-show="!InstitutionStudentController.existingStudent">
                    <label for="Students_start_date"><?=__('Start Date')?></label>
                    <div class="input-group date " id="Students_start_date" style="">
                        <input type="text" class="form-control " name="Students[start_date]" ng-model="InstitutionStudentController.startDate">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.start_date" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.start_date">{{ error }}</p>
                    </div>
                </div>
                <div class="input text required" ng-show="!InstitutionStudentController.existingStudent">
                    <label for="students-end-date"><?=__('End Date')?></label>
                    <input ng-model="InstitutionStudentController.endDateFormatted" type="text" disabled="disabled">
                </div>

                <div class="section-header" ng-show="InstitutionStudentController.existingStudent"><?=__('Student Information')?></div>
                <div class="input string" ng-show="InstitutionStudentController.existingStudent">
                    <label><?=__('Academic Period')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['academic_period']['name']" disabled="disabled">
                </div>
                <div class="input string" ng-show="InstitutionStudentController.existingStudent">
                    <label><?=__('Education Grade')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['education_grade']['name']" disabled="disabled">
                </div>
                <div class="input string" ng-show="InstitutionStudentController.existingStudent">
                    <label><?=__('Student Status')?></label>
                    <input type="string" value="<?=__('Enrolled')?>" disabled="disabled">
                </div>

                <div class="section-header" ng-show="InstitutionStudentController.existingStudent"><?=__('Institution Information')?></div>
                <div class="input string" ng-show="InstitutionStudentController.existingStudent">
                    <label><?=__('Institution')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['institution']['code_name']" disabled="disabled">
                </div>
                <div class="input string" ng-show="InstitutionStudentController.existingStudent">
                    <label><?=__('Area')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['institution']['area']['code_name']" disabled="disabled">
                </div>
                <div class="input string" ng-show="InstitutionStudentController.existingStudent">
                    <label><?=__('Contact Name')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['institution']['contact_person']" disabled="disabled">
                </div>
                <div class="input string" ng-show="InstitutionStudentController.existingStudent">
                    <label><?=__('Telephone')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['institution']['telephone']" disabled="disabled">
                </div>
            </form>
        </div>

        <div class="step-pane sample-pane" data-step="5" data-name="transferStudent">
            <form class="form-horizontal ng-pristine ng-valid" accept-charset="utf-8" method="post" >
                <div class="input string">
                    <label><?=__('Student ID')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['openemis_no']" disabled="disabled">
                </div>
                <div class="input string required">
                    <label><?=__('Admission number')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['admission_no']" >
                </div>
                <div class="input string">
                    <label><?=__('Student')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['name']" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.student_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.student_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string">
                    <label><?=__('Currently Allocated To')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['institution']['code_name']" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.institution_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.institution_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string">
                    <label><?=__('Academic Period')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['academic_period']['name']" disabled="disabled">
                </div>
                <div class="input string">
                    <label><?=__('Education Grade')?></label>
                    <input type="string" ng-model="InstitutionStudentController['selectedStudentData']['institution_students'][0]['education_grade']['name']" disabled="disabled">
                    <div ng-if="InstitutionStudentController.postResponse.error.education_grade_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.education_grade_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input select">
                    <label><?=__('Class')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[class]" id="students-class"
                            ng-options="option.name for option in InstitutionStudentController.classOptions.availableOptions track by option.id"
                            ng-model="InstitutionStudentController.classOptions.selectedOption"
                            ng-change="InstitutionStudentController.onChangeClass()">
                            <option value="">-- <?=__('No Class Assignment')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.institution_class_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.institution_class_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input string">
                    <label><?=__('Student Status')?></label>
                    <input type="string" value="<?=__('Pending Transfer')?>" disabled="disabled">
                </div>
                <div class="input date required">
                    <label for="Students_transfer_start_date"><?=__('Start Date')?></label>
                    <div class="input-group date" id="Students_transfer_start_date" style="">
                        <input type="text" class="form-control " name="Students[transfer_start_date]" ng-model="InstitutionStudentController.startDate">
                        <span class="input-group-addon"><i class="glyphicon glyphicon-calendar"></i></span>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.start_date" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.start_date">{{ error }}</p>
                    </div>
                </div>
                <div class="input string">
                    <label for="students-end-date"><?=__('End Date')?></label>
                    <input ng-model="InstitutionStudentController.endDateFormatted" type="text" disabled="disabled">
                </div>
                <div class="input select required error" ng-model="InstitutionStudentController.postResponse">
                    <label><?=__('Student Transfer Reason')?></label>
                    <div class="input-select-wrapper">
                        <select name="Students[student_transfer_reason_id]" id="students-transfer-reason-id"
                            ng-options="option.name for option in InstitutionStudentController.transferReasonOptions.availableOptions track by option.id"
                            ng-model="InstitutionStudentController.transferReasonOptions.selectedOption">
                            <option value="">-- <?=__('Select')?> --</option>
                        </select>
                    </div>
                    <div ng-if="InstitutionStudentController.postResponse.error.student_transfer_reason_id" class="error-message">
                        <p ng-repeat="error in InstitutionStudentController.postResponse.error.student_transfer_reason_id">{{ error }}</p>
                    </div>
                </div>
                <div class="input text">
                    <label><?=__('Comment')?></label>
                    <textarea ng-model="InstitutionStudentController.comment" ng-init="InstitutionStudentController.comment=''"></textarea>
                </div>
            </form>
        </div>
    </div>
    <div class="actions bottom">
    </div>
</div>

<script>
$(function () {
var datepicker0 = $('#Students_start_date').datepicker({"format":"dd-mm-yyyy","todayBtn":"linked","orientation":"auto","autoclose":true});
var datepicker1 = $('#Students_date_of_birth').datepicker({"format":"dd-mm-yyyy","todayBtn":"linked","orientation":"auto","autoclose":true});
var datepicker2 = $('#Student_date_of_birth').datepicker({"format":"dd-mm-yyyy","todayBtn":"linked","orientation":"auto","autoclose":true});
var datepicker3 = $('#Students_transfer_start_date').datepicker({"format":"dd-mm-yyyy","todayBtn":"linked","orientation":"auto","autoclose":true});
$( document ).on('DOMMouseScroll mousewheel scroll', function(){
    window.clearTimeout( t );
    t = window.setTimeout( function(){
        datepicker0.datepicker('place');
        datepicker1.datepicker('place');
        datepicker2.datepicker('place');
        datepicker3.datepicker('place');
    });
});
});

//]]>
</script>


<?php
$this->end();
?>
